<?php
class Pageley_Domain_Validator_Required extends Pageley_Domain_Validator_Abstract {
	private $requiredMessage = "error.validation.required";

	public function setRequiredMessage($requiredMessage) {
		$this->requiredMessage = $requiredMessage;
	}

	public function validate($value, $propertyName, $object) {
		$errors = new Pageley_Util_ArrayMap();
		$empty = $this->rejectIfEmpty($value, $propertyName, $this->requiredMessage);
		if($empty) {
			$errors->put($propertyName, $empty);
		}
		return $errors;
	}
}